#include<stdio.h>
#include<stdlib.h>

int main(int argc, char *argv[])
{
	if(argc < 3){
		return -1;
	}
	FILE * fp = NULL;
	fp = fopen(argv[1], "r");
	if(fp == NULL){
		return 1;
	}
	int lines = atoi(argv[2]);
	if(lines < 1){
		return 1;
	}

	char *str = NULL;
	size_t n = 0;

	for(int i = 1; i <= lines; i++){
		if(getline(&str, &n, fp) == -1){
			return 1;
		}
	}
	fputs(str, stdout);
	fclose(fp);
	return 0;
}
